package com.tanhua.model.vo;

/**
 * @author lamy
 * @version 1.0
 * @ClassName: VoiceVo
 * @date 2021-12-26 10:21:44
 */
import com.tanhua.model.db.UserInfo;
import com.tanhua.model.mongo.Voice;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class VoiceVo implements Serializable {

    private Integer id;
    private String avatar;
    private String nickname;
    private String gender;
    private Integer age;
    //语音地址
    private String soundUrl;
    //剩余次数
    private Integer remainingTimes;

    public static VoiceVo init(UserInfo userInfo, Voice voice) {
        VoiceVo vo = new VoiceVo();
        BeanUtils.copyProperties(userInfo,vo);
        vo.setId(voice.getUserId().intValue());
        vo.setSoundUrl(voice.getVoiceUrl());
        return vo;
    }
}
